package com.zhq.user.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.zhq.Interface.user.dao.IUserDao;
import com.zhq.Interface.user.service.IUserService;
import com.zhq.user.entity.User;

/**
 * 
 * <p></p>
 * @author zhanghanqing 2013-11-15 下午10:55:21
 * @version V1.0   
 * @modificationHistory=========================逻辑或功能性重大变更记录
 * @modify by user: {修改人} 2013-11-15
 * @modify by reason:{方法名}:{原因}
 */
public class UserService implements IUserService,Serializable{

	/**
     * 序列化ID
     */
    private static final long serialVersionUID = 7776096558198582874L;
	@Autowired
	private IUserDao userDao;
	public boolean isExist(int id) {
        if (null!=userDao.fetchUserById(id)) {
	        return true;
        }
        return false;
	}
	public List<User> fetchUsers() {
	    return userDao.fetchUsers();
    }
	
    public void setUserDao(IUserDao userDao) {
    	this.userDao = userDao;
    }
	public void addUser(User user) {
		userDao.saveUser(user);
    }
	public void deleteUser(int id) {
		userDao.deleteUser(id);
    }
	public User fetchUserById(int id) {
		return userDao.fetchUserById(id);
    }
	public void modifyUser(User user) {
	    userDao.updateUser(user);	    
    }
}
